import Vue from "vue";
import App from "./App.vue";
import router from "./router";
import store from "./store";

import "./router/routeGuard.js"//路由守卫

import 'lib-flexible';
import hlvyLoading from "@/components/hlvyLoading.vue";

// import '@/assets/icon/iconfont.css';
import '@/assets/icon/demo.css';

/*分页页码*/
import pagination from '@/components/pagination.vue';
/*标题*/
import hlvyTitle from '@/components/hlvyTitle.vue';
/*模态框*/
import hlvyDia from '@/components/hlvyDia.vue';

/*自定义element标签名开始*/
import Mock from "mockjs";
import {Input,
  Button,
  Radio,
  RadioGroup,
  RadioButton,
  Checkbox,
  CheckboxButton,
  CheckboxGroup,
  Switch,
  Select,
  Tabs,
  TabPane,
  Form,
  FormItem,
  MessageBox,
} from 'element-ui';

import 'element-ui/lib/theme-chalk/index.css';// table 的样式需要手动引入
import 'element-ui/lib/theme-chalk/icon.css';
import 'element-ui/lib/theme-chalk/table.css';
import 'element-ui/lib/theme-chalk/table-column.css';

Vue.config.productionTip = false
function _extend(base, clazz) {
    return {
        extends:base,
        mounted:function() {
            var el = this.$el;
            el.className = el.className + " " + clazz;
        }
    };
}

function _install(Vue, name, comp) {
    Vue.component(name, _extend(comp, name));
}

function _confirm(message, fok, fcancel) {
    MessageBox.confirm(message, '确认', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
      //  type: 'warning'
    }).then(() => {
        if(fok) {
            fok();
        }
    }).catch(() => {
        if(fcancel) {
            fcancel();
        }
    });
}

const install = function(Vue, opts = {}) {
    _install(Vue, "hlvy-input", Input);
    _install(Vue, "hlvy-button", Button);
    _install(Vue, "hlvy-switch", Switch);
    _install(Vue, "hlvy-radio", Radio);
    _install(Vue, "hlvy-radio-group", RadioGroup);
    _install(Vue, "hlvy-form", Form);
    _install(Vue, "hlvy-form-item", FormItem);
    _install(Vue, "hlvy-tabs", Tabs);
    _install(Vue, "hlvy-tab-pane", TabPane);
    _install(Vue, "hlvy-loading", hlvyLoading);
    _install(Vue, "hlvy-checkbox", Checkbox);
    _install(Vue, "hlvy-page", pagination);
    _install(Vue, "hlvy-title", hlvyTitle);
    _install(Vue, "hlvy-dia", hlvyDia);
    Vue.prototype.$confirm = _confirm;
};
Vue.use(install);

/*自定义element标签名结束*/


import  elementUi from 'element-ui'
Vue.use(elementUi);


import VueCompositionApi from '@vue/composition-api'
Vue.use(VueCompositionApi)


import '@/assets/icon/iconfont.css';
import '@/assets/icon/demo.css';





Vue.config.productionTip = false;

new Vue({
  router,
  store,
  render: h => h(App)
}).$mount("#app");
